<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // function Factory(){
        // {} new  
    //     let obj = new Object();
    //     obj.myname = "张三";
    //     obj.age = 20;
    //     return obj;
    // }

    class Luban{
        constructor(){
            this.name = "鲁班";
        }
    }
    class Yase{
        constructor(){
            this.name = "亚瑟";
        }
    }


    function Factory(heroName){
        if(heroName==="luban"){
            return new Luban();
        }else if(heroName==="yase"){
            return  new Yase();
        }
    }
    Factory("luban");
    Factory("yase");
    

    





</script>
</html>